/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.usc.cs523.client;

import com.jme3.animation.AnimChannel;
import com.jme3.animation.AnimControl;
import com.jme3.animation.LoopMode;
import com.jme3.asset.AssetManager;
import com.jme3.bullet.control.RigidBodyControl;
import com.jme3.math.Vector3f;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;

/**
 *
 * @author haoxu
 */
public class Rival {

    int id;
    Vector3f position;
    Vector3f direction;
    Node model;
    AssetManager assetManager;
    int HP;
    int MP;
    float Speed_Factor = 1.0f;
    float Power_Factor = 1.0f;
    int model_num;
    private RigidBodyControl model_phy;

    public Rival(AssetManager assetManager) {
        this.assetManager = assetManager;
        position = new Vector3f(0f, 10f, 0f);
        direction = new Vector3f(1f, 0f, 0f);
        HP = 100;
        MP = 100;
    }

    public Rival() {
        HP = 100;
        MP = 100;
    }

    public Vector3f getDirection() {
        return direction;
    }

    public void setDirection(Vector3f direction) {
        this.direction = direction;
    }

    public Vector3f getPosition() {
        return position;
    }

    public void setPosition(Vector3f position) {
        this.position = position;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public Node getModel() {
        if (model == null) {
            if (this.model_num == 1) {
                model = (Node) assetManager.loadModel("Models/Buggy/Buggy.j3o");
                model_phy = new RigidBodyControl(0.0f);
                model.addControl(model_phy);
                model.setLocalScale(1.5f);
            } else {
                if (this.model_num == 2) {
                    model = (Node) assetManager.loadModel("Models/HoverTank/HoverTank.j3o");
                    model_phy = new RigidBodyControl(0.0f);
                    model.addControl(model_phy);
                    model.setLocalScale(1.5f);
                }
            }
        }
        return model;
    }

    public Spatial getSpatial() {
        return (Spatial) this.getModel();
    }

    public void setModel(Node model) {
        this.model = model;
    }

    public int getModel_num() {
        return model_num;
    }

    public void setModel_num(int model_num) {
        this.model_num = model_num;

        if (model_num == 1) {
            this.Speed_Factor = 1.3f;
            this.Power_Factor = 0.8f;
        }

        if (model_num == 2) {
            this.Speed_Factor = 0.8f;
            this.Power_Factor = 1.2f;
        }
    }
}
